<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml"
      xmlns:s="http://jboss.com/products/seam/taglib"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets">

<ui:composition template="#{store.templatePath}/template.xhtml">
    <ui:define name="title">
        <h:outputText value="#{category.name}" rendered="#{category.id != null}" />
        <h:outputText value="#{messages.allGoods}" rendered="#{category.id == null}" />
    </ui:define>


    <ui:define name="body">


        <h1 class="category-title">
            <h:outputText value="#{category.name}"  rendered="#{category.name != null}"/>
            <h:outputText value="#{messages.allGoods}" rendered="#{category.name == null}"/>
        </h1>
        <h:outputText value="#{category.description}" rendered="#{category.description != null}" escape="false" />


            <ui:repeat value="#{products}" var="product">
                <div class="product">
                    <div class="product-image">
                        <s:link view="/product.xhtml" propagation="none">
                            <f:param name="cat" value="#{product.categories.toArray()[0].id}"/>
                            <f:param name="alias" value="#{product.urlAlias}"/>
                            <h:graphicImage value="#{product.urlImageSmall}"
                                            alt="#{product.name}"
                                            rendered="#{product.urlImageSmall != null}" />
                            <h:graphicImage value="/r/pi/#{product.urlAlias}-s.jpg"
                                            alt="#{product.name}"
                                            rendered="#{product.urlImageSmall == null}" /><br/>

                        </s:link>
                    </div>
                    <s:link view="/product.xhtml" value="#{product.name}" propagation="none">
                        <f:param name="cat" value="#{product.categories.toArray()[0].id}"/>
                        <f:param name="alias" value="#{product.urlAlias}"/>
                    </s:link><br/>

                    <div class="product-description">#{product.description}</div>

                    <ui:include src="/incl/price.xhtml" />


                </div>
            </ui:repeat>

    </ui:define>

</ui:composition>

</html>